'''
''' IBAN Functions - IBANContents.vb
'''
''' This program is free software; you can redistribute it and/or modify
''' it under the terms of the GNU General Public License as published by
''' the Free Software Foundation; either version 2 of the License, or
''' (at your option) any later version.
'''
''' This program is distributed in the hope that it will be useful,
''' but WITHOUT ANY WARRANTY; without even the implied warranty of
''' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
''' GNU General Public License for more details.
'''
''' You should have received a copy of the GNU General Public License
''' along with this program; if not, write to the Free Software
''' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
''' 

''' -----------------------------------------------------------------------------
''' Project	 : IBANFuncsCore
''' Class	 : Core.IBANContents
''' 
''' -----------------------------------------------------------------------------
''' <summary>
''' This class provides the blueprint for storing a decomposed IBAN.
''' </summary>
''' <remarks>
''' Objects of this class serve as placeholders and do not perform
''' any validation or calculation of check digits.
''' </remarks>
''' <history>
''' 	[Nick]	2/8/2007	Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class IBANContents

#Region "Class variables"

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Internal representation of the country code.
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Private _CountryCode As String

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Internal representation of the check digits.
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Private _CheckDigits As String

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Internal representation of the bank code.
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Private _BankCode As String

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Internal representation of the branch code.
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Private _BranchCode As String

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Internal representation of the account number.
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Private _AccountNumber As String

#End Region

#Region "Properties"

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Property to get the country code of this instance.
    ''' </summary>
    ''' <value>String value of country code.</value>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public ReadOnly Property CountryCode() As String
        Get
            Return _CountryCode
        End Get
    End Property

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Property to get/set the check digits of this instance.
    ''' </summary>
    ''' <value>String value of check digits.</value>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Property CheckDigits() As String
        Get
            Return _CheckDigits
        End Get
        Set(ByVal Value As String)
            _CheckDigits = Value
        End Set
    End Property

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Property to get the bank code of this instance.
    ''' </summary>
    ''' <value>String representation of the bank code.</value>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public ReadOnly Property BankCode() As String
        Get
            Return _BankCode
        End Get
    End Property

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Property to get the branch code of this instance.
    ''' </summary>
    ''' <value>String representation of the branch code.</value>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public ReadOnly Property BranchCode() As String
        Get
            Return _BranchCode
        End Get
    End Property

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Property to get the account number of this instance.
    ''' </summary>
    ''' <value>String representation of the account number.</value>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public ReadOnly Property AccountNumber() As String
        Get
            Return _AccountNumber
        End Get
    End Property

#End Region

#Region "Constructors"

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Default constructor.
    ''' </summary>
    ''' <param name="CountryCode">The instance's country code.</param>
    ''' <param name="CheckDigits">The instance's check digits.</param>
    ''' <param name="BankCode">The instance's bank code.</param>
    ''' <param name="BranchCode">The instance's branch code.</param>
    ''' <param name="AccountNumber">The instance's account number.</param>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Sub New(ByVal CountryCode As String, ByVal CheckDigits As String, _
                   ByVal BankCode As String, ByVal BranchCode As String, _
                   ByVal AccountNumber As String)

        _CountryCode = CountryCode
        _CheckDigits = CheckDigits
        _BankCode = BankCode
        _BranchCode = BranchCode
        _AccountNumber = AccountNumber

    End Sub

#End Region

#Region "Public methods"

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Compares the given instance with another instance of this class.
    ''' </summary>
    ''' <param name="Account">Other instance of this class.</param>
    ''' <returns>True/False.</returns>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Function Compare(ByVal Account As IBANContents) As Boolean
        Return (Me.BankCode = Account.BankCode) And _
               (Me.BranchCode = Account.BranchCode) And _
               (Me.AccountNumber = Account.AccountNumber) And _
               (Me.CountryCode = Account.CountryCode) And _
               (Me.CheckDigits = Account.CheckDigits)
    End Function

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Compares two instances of this class.
    ''' </summary>
    ''' <param name="Account1">First instance of this class.</param>
    ''' <param name="Account2">Second instance of this class.</param>
    ''' <returns>True/False.</returns>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Shared Function Compare(ByVal Account1 As IBANContents, ByVal Account2 As IBANContents) As Boolean
        Return Account1.Compare(Account2)
    End Function

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Copies the given instance of this class to another one.
    ''' </summary>
    ''' <returns>Copy of this instance.</returns>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Function Copy() As IBANContents
        Return New IBANContents(Me.CountryCode, Me.CheckDigits, Me.BankCode, Me.BranchCode, Me.AccountNumber)
    End Function

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Copies an instance of this class to another one.
    ''' </summary>
    ''' <param name="Account">Instance to be copied.</param>
    ''' <returns>Copied instance.</returns>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Shared Function Copy(ByVal Account As IBANContents) As IBANContents
        Return New IBANContents(Account.CountryCode, Account.CheckDigits, Account.BankCode, Account.BranchCode, Account.AccountNumber)
    End Function

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Returns a string representation of this instance (i.e. IBAN form).
    ''' </summary>
    ''' <returns>IBAN representation of this instance.</returns>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[Nick]	2/8/2007	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Overrides Function ToString() As String
        Return Me.CountryCode + Me.CheckDigits + Me.BankCode + Me.BranchCode + Me.AccountNumber
    End Function

#End Region

End Class
